package geektime.spring.hello.hellospring.controller;

import java.util.Arrays;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import geektime.spring.hello.hellospring.entity.City;
import geektime.spring.hello.hellospring.service.CityService;
import geektime.spring.hello.hellospring.service.TestService;
@RestController
@RequestMapping("city")
public class CityController {
	@Autowired
	private CityService CityService;
	@Autowired
	private TestService testService;
	private static final Logger logger = LoggerFactory.getLogger(TestService.class);
	@RequestMapping("getAll")
	public List<City> getAll() {
		return CityService.getAll();
	}
	@RequestMapping("add")
	public String add() throws InterruptedException {
		logger.info("测试数据");
		testService.getAll();
		System.out.println("---------");
		return "ok";
	}
	public static void main(String[] args) {
		int a=1;
		int b=2;
		a=a+b;
		b=a-b;
		a=a-b;
		System.out.println(a+","+b);
		
		List<String> avengersRoster = Arrays.asList("iron man", "captain America");
		avengersRoster.forEach(c ->System.out.println(c));
	}

}
